/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.jsysacc.comercial.resources.commons;

import java.awt.Color;
import java.awt.Component;
import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;

/**
 *
 * @author Carlos
 */
public class MiRenderTable extends DefaultTableCellRenderer {

    @Override
    public Component getTableCellRendererComponent(JTable table,
            Object value,
            boolean isSelected,
            boolean hasFocus,
            int row,
            int column) {
        super.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
        this.setOpaque(true);
        //        this.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        this.setForeground(Color.BLACK);
        if (isSelected) {
            this.setFont(new java.awt.Font("Tahoma", 1, 11));
            this.setBackground(Color.gray);
        } else {
            if (row % 2 == 0) {
                this.setBackground(Color.lightGray);
            } else {
                this.setBackground(Color.WHITE);
            }
        }

        return this;
    }
}